<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - id:000977,sync:fuzzer2,src:001052.lcov_info_final - test/gmock-1.7.0/src/gmock-internal-utils.cc</title>
  <link rel="stylesheet" type="text/css" href="../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../index.html">top level</a> - <a href="index.html">test/gmock-1.7.0/src</a> - gmock-internal-utils.cc<span style="font-size: 80%;"> (source / <a href="gmock-internal-utils.cc.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">id:000977,sync:fuzzer2,src:001052.lcov_info_final</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">44</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2016-03-13 10:42:47</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">8</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr><td><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // Copyright 2007, Google Inc.</a>
<span class="lineNum">       2 </span>            : // All rights reserved.
<span class="lineNum">       3 </span>            : //
<span class="lineNum">       4 </span>            : // Redistribution and use in source and binary forms, with or without
<span class="lineNum">       5 </span>            : // modification, are permitted provided that the following conditions are
<span class="lineNum">       6 </span>            : // met:
<span class="lineNum">       7 </span>            : //
<span class="lineNum">       8 </span>            : //     * Redistributions of source code must retain the above copyright
<span class="lineNum">       9 </span>            : // notice, this list of conditions and the following disclaimer.
<span class="lineNum">      10 </span>            : //     * Redistributions in binary form must reproduce the above
<span class="lineNum">      11 </span>            : // copyright notice, this list of conditions and the following disclaimer
<span class="lineNum">      12 </span>            : // in the documentation and/or other materials provided with the
<span class="lineNum">      13 </span>            : // distribution.
<span class="lineNum">      14 </span>            : //     * Neither the name of Google Inc. nor the names of its
<span class="lineNum">      15 </span>            : // contributors may be used to endorse or promote products derived from
<span class="lineNum">      16 </span>            : // this software without specific prior written permission.
<span class="lineNum">      17 </span>            : //
<span class="lineNum">      18 </span>            : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
<span class="lineNum">      19 </span>            : // &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
<span class="lineNum">      20 </span>            : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
<span class="lineNum">      21 </span>            : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
<span class="lineNum">      22 </span>            : // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
<span class="lineNum">      23 </span>            : // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
<span class="lineNum">      24 </span>            : // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
<span class="lineNum">      25 </span>            : // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
<span class="lineNum">      26 </span>            : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<span class="lineNum">      27 </span>            : // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<span class="lineNum">      28 </span>            : // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<span class="lineNum">      29 </span>            : //
<span class="lineNum">      30 </span>            : // Author: wan@google.com (Zhanyong Wan)
<span class="lineNum">      31 </span>            : 
<span class="lineNum">      32 </span>            : // Google Mock - a framework for writing C++ mock classes.
<span class="lineNum">      33 </span>            : //
<span class="lineNum">      34 </span>            : // This file defines some utilities useful for implementing Google
<span class="lineNum">      35 </span>            : // Mock.  They are subject to change without notice, so please DO NOT
<span class="lineNum">      36 </span>            : // USE THEM IN USER CODE.
<span class="lineNum">      37 </span>            : 
<span class="lineNum">      38 </span>            : #include &quot;gmock/internal/gmock-internal-utils.h&quot;
<span class="lineNum">      39 </span>            : 
<span class="lineNum">      40 </span>            : #include &lt;ctype.h&gt;
<span class="lineNum">      41 </span>            : #include &lt;ostream&gt;  // NOLINT
<span class="lineNum">      42 </span>            : #include &lt;string&gt;
<span class="lineNum">      43 </span>            : #include &quot;gmock/gmock.h&quot;
<span class="lineNum">      44 </span>            : #include &quot;gmock/internal/gmock-port.h&quot;
<span class="lineNum">      45 </span>            : #include &quot;gtest/gtest.h&quot;
<span class="lineNum">      46 </span>            : 
<span class="lineNum">      47 </span>            : namespace testing {
<span class="lineNum">      48 </span>            : namespace internal {
<span class="lineNum">      49 </span>            : 
<span class="lineNum">      50 </span>            : // Converts an identifier name to a space-separated list of lower-case
<span class="lineNum">      51 </span>            : // words.  Each maximum substring of the form [A-Za-z][a-z]*|\d+ is
<a name="52"><span class="lineNum">      52 </span>            : // treated as one word.  For example, both &quot;FooBar123&quot; and</a>
<span class="lineNum">      53 </span>            : // &quot;foo_bar_123&quot; are converted to &quot;foo bar 123&quot;.
<span class="lineNum">      54 </span><span class="lineNoCov">          0 : GTEST_API_ string ConvertIdentifierNameToWords(const char* id_name) {</span>
<span class="lineNum">      55 </span><span class="lineNoCov">          0 :   string result;</span>
<span class="lineNum">      56 </span><span class="lineNoCov">          0 :   char prev_char = '\0';</span>
<span class="lineNum">      57 </span><span class="lineNoCov">          0 :   for (const char* p = id_name; *p != '\0'; prev_char = *(p++)) {</span>
<span class="lineNum">      58 </span>            :     // We don't care about the current locale as the input is
<span class="lineNum">      59 </span>            :     // guaranteed to be a valid C++ identifier name.
<span class="lineNum">      60 </span><span class="lineNoCov">          0 :     const bool starts_new_word = IsUpper(*p) ||</span>
<span class="lineNum">      61 </span><span class="lineNoCov">          0 :         (!IsAlpha(prev_char) &amp;&amp; IsLower(*p)) ||</span>
<span class="lineNum">      62 </span><span class="lineNoCov">          0 :         (!IsDigit(prev_char) &amp;&amp; IsDigit(*p));</span>
<span class="lineNum">      63 </span>            : 
<span class="lineNum">      64 </span><span class="lineNoCov">          0 :     if (IsAlNum(*p)) {</span>
<span class="lineNum">      65 </span><span class="lineNoCov">          0 :       if (starts_new_word &amp;&amp; result != &quot;&quot;)</span>
<span class="lineNum">      66 </span><span class="lineNoCov">          0 :         result += ' ';</span>
<span class="lineNum">      67 </span><span class="lineNoCov">          0 :       result += ToLower(*p);</span>
<span class="lineNum">      68 </span>            :     }
<span class="lineNum">      69 </span>            :   }
<span class="lineNum">      70 </span><span class="lineNoCov">          0 :   return result;</span>
<span class="lineNum">      71 </span>            : }
<span class="lineNum">      72 </span>            : 
<span class="lineNum">      73 </span>            : // This class reports Google Mock failures as Google Test failures.  A
<a name="74"><span class="lineNum">      74 </span>            : // user can define another class in a similar fashion if he intends to</a>
<span class="lineNum">      75 </span>            : // use Google Mock with a testing framework other than Google Test.
<a name="76"><span class="lineNum">      76 </span><span class="lineNoCov">          0 : class GoogleTestFailureReporter : public FailureReporterInterface {</span></a>
<span class="lineNum">      77 </span>            :  public:
<span class="lineNum">      78 </span><span class="lineNoCov">          0 :   virtual void ReportFailure(FailureType type, const char* file, int line,</span>
<span class="lineNum">      79 </span>            :                              const string&amp; message) {
<span class="lineNum">      80 </span>            :     AssertHelper(type == kFatal ?
<span class="lineNum">      81 </span>            :                  TestPartResult::kFatalFailure :
<span class="lineNum">      82 </span>            :                  TestPartResult::kNonFatalFailure,
<span class="lineNum">      83 </span>            :                  file,
<span class="lineNum">      84 </span>            :                  line,
<span class="lineNum">      85 </span><span class="lineNoCov">          0 :                  message.c_str()) = Message();</span>
<span class="lineNum">      86 </span><span class="lineNoCov">          0 :     if (type == kFatal) {</span>
<span class="lineNum">      87 </span><span class="lineNoCov">          0 :       posix::Abort();</span>
<span class="lineNum">      88 </span>            :     }
<span class="lineNum">      89 </span><span class="lineNoCov">          0 :   }</span>
<span class="lineNum">      90 </span>            : };
<span class="lineNum">      91 </span>            : 
<a name="92"><span class="lineNum">      92 </span>            : // Returns the global failure reporter.  Will create a</a>
<span class="lineNum">      93 </span>            : // GoogleTestFailureReporter and return it the first time called.
<span class="lineNum">      94 </span><span class="lineNoCov">          0 : GTEST_API_ FailureReporterInterface* GetFailureReporter() {</span>
<span class="lineNum">      95 </span>            :   // Points to the global failure reporter used by Google Mock.  gcc
<span class="lineNum">      96 </span>            :   // guarantees that the following use of failure_reporter is
<span class="lineNum">      97 </span>            :   // thread-safe.  We may need to add additional synchronization to
<span class="lineNum">      98 </span>            :   // protect failure_reporter if we port Google Mock to other
<span class="lineNum">      99 </span>            :   // compilers.
<span class="lineNum">     100 </span>            :   static FailureReporterInterface* const failure_reporter =
<span class="lineNum">     101 </span><span class="lineNoCov">          0 :       new GoogleTestFailureReporter();</span>
<span class="lineNum">     102 </span><span class="lineNoCov">          0 :   return failure_reporter;</span>
<span class="lineNum">     103 </span>            : }
<span class="lineNum">     104 </span>            : 
<span class="lineNum">     105 </span>            : // Protects global resources (stdout in particular) used by Log().
<span class="lineNum">     106 </span>            : static GTEST_DEFINE_STATIC_MUTEX_(g_log_mutex);
<span class="lineNum">     107 </span>            : 
<a name="108"><span class="lineNum">     108 </span>            : // Returns true iff a log with the given severity is visible according</a>
<span class="lineNum">     109 </span>            : // to the --gmock_verbose flag.
<span class="lineNum">     110 </span><span class="lineNoCov">          0 : GTEST_API_ bool LogIsVisible(LogSeverity severity) {</span>
<span class="lineNum">     111 </span><span class="lineNoCov">          0 :   if (GMOCK_FLAG(verbose) == kInfoVerbosity) {</span>
<span class="lineNum">     112 </span>            :     // Always show the log if --gmock_verbose=info.
<span class="lineNum">     113 </span><span class="lineNoCov">          0 :     return true;</span>
<span class="lineNum">     114 </span><span class="lineNoCov">          0 :   } else if (GMOCK_FLAG(verbose) == kErrorVerbosity) {</span>
<span class="lineNum">     115 </span>            :     // Always hide it if --gmock_verbose=error.
<span class="lineNum">     116 </span><span class="lineNoCov">          0 :     return false;</span>
<span class="lineNum">     117 </span>            :   } else {
<span class="lineNum">     118 </span>            :     // If --gmock_verbose is neither &quot;info&quot; nor &quot;error&quot;, we treat it
<span class="lineNum">     119 </span>            :     // as &quot;warning&quot; (its default value).
<span class="lineNum">     120 </span><span class="lineNoCov">          0 :     return severity == kWarning;</span>
<span class="lineNum">     121 </span>            :   }
<span class="lineNum">     122 </span>            : }
<span class="lineNum">     123 </span>            : 
<span class="lineNum">     124 </span>            : // Prints the given message to stdout iff 'severity' &gt;= the level
<span class="lineNum">     125 </span>            : // specified by the --gmock_verbose flag.  If stack_frames_to_skip &gt;=
<span class="lineNum">     126 </span>            : // 0, also prints the stack trace excluding the top
<span class="lineNum">     127 </span>            : // stack_frames_to_skip frames.  In opt mode, any positive
<span class="lineNum">     128 </span>            : // stack_frames_to_skip is treated as 0, since we don't know which
<a name="129"><span class="lineNum">     129 </span>            : // function calls will be inlined by the compiler and need to be</a>
<span class="lineNum">     130 </span>            : // conservative.
<span class="lineNum">     131 </span><span class="lineNoCov">          0 : GTEST_API_ void Log(LogSeverity severity,</span>
<span class="lineNum">     132 </span>            :                     const string&amp; message,
<span class="lineNum">     133 </span>            :                     int stack_frames_to_skip) {
<span class="lineNum">     134 </span><span class="lineNoCov">          0 :   if (!LogIsVisible(severity))</span>
<span class="lineNum">     135 </span><span class="lineNoCov">          0 :     return;</span>
<span class="lineNum">     136 </span>            : 
<span class="lineNum">     137 </span>            :   // Ensures that logs from different threads don't interleave.
<span class="lineNum">     138 </span><span class="lineNoCov">          0 :   MutexLock l(&amp;g_log_mutex);</span>
<span class="lineNum">     139 </span>            : 
<span class="lineNum">     140 </span>            :   // &quot;using ::std::cout;&quot; doesn't work with Symbian's STLport, where cout is a
<span class="lineNum">     141 </span>            :   // macro.
<span class="lineNum">     142 </span>            : 
<span class="lineNum">     143 </span><span class="lineNoCov">          0 :   if (severity == kWarning) {</span>
<span class="lineNum">     144 </span>            :     // Prints a GMOCK WARNING marker to make the warnings easily searchable.
<span class="lineNum">     145 </span><span class="lineNoCov">          0 :     std::cout &lt;&lt; &quot;\nGMOCK WARNING:&quot;;</span>
<span class="lineNum">     146 </span>            :   }
<span class="lineNum">     147 </span>            :   // Pre-pends a new-line to message if it doesn't start with one.
<span class="lineNum">     148 </span><span class="lineNoCov">          0 :   if (message.empty() || message[0] != '\n') {</span>
<span class="lineNum">     149 </span><span class="lineNoCov">          0 :     std::cout &lt;&lt; &quot;\n&quot;;</span>
<span class="lineNum">     150 </span>            :   }
<span class="lineNum">     151 </span><span class="lineNoCov">          0 :   std::cout &lt;&lt; message;</span>
<span class="lineNum">     152 </span><span class="lineNoCov">          0 :   if (stack_frames_to_skip &gt;= 0) {</span>
<span class="lineNum">     153 </span>            : #ifdef NDEBUG
<span class="lineNum">     154 </span>            :     // In opt mode, we have to be conservative and skip no stack frame.
<span class="lineNum">     155 </span>            :     const int actual_to_skip = 0;
<span class="lineNum">     156 </span>            : #else
<span class="lineNum">     157 </span>            :     // In dbg mode, we can do what the caller tell us to do (plus one
<span class="lineNum">     158 </span>            :     // for skipping this function's stack frame).
<span class="lineNum">     159 </span><span class="lineNoCov">          0 :     const int actual_to_skip = stack_frames_to_skip + 1;</span>
<span class="lineNum">     160 </span>            : #endif  // NDEBUG
<span class="lineNum">     161 </span>            : 
<span class="lineNum">     162 </span>            :     // Appends a new-line to message if it doesn't end with one.
<span class="lineNum">     163 </span><span class="lineNoCov">          0 :     if (!message.empty() &amp;&amp; *message.rbegin() != '\n') {</span>
<span class="lineNum">     164 </span><span class="lineNoCov">          0 :       std::cout &lt;&lt; &quot;\n&quot;;</span>
<span class="lineNum">     165 </span>            :     }
<span class="lineNum">     166 </span><span class="lineNoCov">          0 :     std::cout &lt;&lt; &quot;Stack trace:\n&quot;</span>
<span class="lineNum">     167 </span><span class="lineNoCov">          0 :          &lt;&lt; ::testing::internal::GetCurrentOsStackTraceExceptTop(</span>
<span class="lineNum">     168 </span><span class="lineNoCov">          0 :              ::testing::UnitTest::GetInstance(), actual_to_skip);</span>
<span class="lineNum">     169 </span>            :   }
<span class="lineNum">     170 </span><span class="lineNoCov">          0 :   std::cout &lt;&lt; ::std::flush;</span>
<span class="lineNum">     171 </span>            : }
<span class="lineNum">     172 </span>            : 
<span class="lineNum">     173 </span>            : }  // namespace internal
<span class="lineNum">     174 </span>            : }  // namespace testing
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.11</a></td></tr>
  </table>
  <br>

</body>
</html>
